package com.hyc.myvideo.ui.activity.my;

import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.hyc.myvideo.R;
import com.hyc.myvideo.data.adapter.my.download.DownloadAdapter;
import com.hyc.myvideo.data.api.model.Download;
import com.hyc.myvideo.ui.base.BaseFActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 我的下载
 * @author gyb
 * @version 1.0
 * @created 2017/07/18
 */
public class DownloadActivity extends BaseFActivity implements AdapterView.OnItemClickListener{
    @BindView(R.id.common_head_list_id) PullToRefreshListView toRefreshListView;
    private DownloadAdapter adapter = null;
    private List<Download> listData = null;
    @Override
    public int getContentViewId() {
        return R.layout.activity_common_listview_head;
    }
    @Override
    protected void initView() {
        setLeftBtnClick(true,getIntent().getStringExtra("title"));
        //toRefreshListView.setMode(PullToRefreshBase.Mode.DISABLED);
        toRefreshListView.setOnItemClickListener(this);
        listData = new ArrayList<>();
        adapter = new DownloadAdapter(this,getDownloadList());
        toRefreshListView.setAdapter(adapter);
        toRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
            @Override public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView){

            }

            @Override public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {

            }
        });
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void oNext(String resulte, String method) {

    }

    @Override
    protected void oError() {

    }

    //测试数据
    private List<Download> getDownloadList(){
        List<Download> list = new ArrayList<>();
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","俄军米格31战机","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://p2.ifengimg.com/fck/2017_29/c11e6f56802d591_w602_h391.png","7.8级地震","俄科曼多尔群岛地区发生7.8级地震 造成海啸巨浪"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","俄军米格31战机","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","俄军米格31战机","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","俄军米格31战机","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","地区发生7.8级地震","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","俄军米格31战机","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://p2.ifengimg.com/fck/2017_29/c11e6f56802d591_w602_h391.png","7.8级地震","俄科曼多尔群岛地区发生7.8级地震 造成海啸巨浪"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","俄军米格31战机","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","俄军米格31战机","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","俄军米格31战机","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","地区发生7.8级地震","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","俄军米格31战机","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://p2.ifengimg.com/fck/2017_29/c11e6f56802d591_w602_h391.png","7.8级地震","俄科曼多尔群岛地区发生7.8级地震 造成海啸巨浪"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","俄军米格31战机","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","俄军米格31战机","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","俄军米格31战机","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        list.add(new Download("1","http://images.haiwainet.cn/20170718/1500342165930656.jpg","地区发生7.8级地震","俄军米格31战机进行拦截演习 成功摧毁巡航导弹"));
        return list;
    }










    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        int size = toRefreshListView.getRefreshableView().getHeaderViewsCount();

    }
}
